package com.datang.springcode.incidentMonitor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;
import java.util.concurrent.ScheduledThreadPoolExecutor;

@Configuration
@ComponentScan(value = "com.datang.springcode.incidentMonitor")
public class ListenerConfig {
    @Bean
    public EmailService emailService() {

        EmailService emailService = new EmailService();
        // 在这里添加黑名单集合
        emailService.setBlackList(Arrays.asList("known.spammer@example.org", "known.hacker@example.org", "john.doe@example.org", "blackAddredd@123.com"));

        return emailService;
    }

    @Bean
    public BlackListNotifier blackListNotifier() {
        return new BlackListNotifier();
    }

    @Bean
    public ScheduledThreadPoolExecutor scheduledExecutorService() {
        ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(20);
        return executor;
    }
}
